package com.xingkeduo.business.order.controller;

import com.fasterxml.jackson.databind.node.ObjectNode;
import com.xingkeduo.business.order.service.ConsumerService;
import com.xingkeduo.dto.param.ConsumerPrivateParameterDto;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 授权封装
 *
 * @Description:
 * @Author:gaozifeng
 * @Date 2019/5/22 16:39
 **/
@RestController
@RequestMapping("/service")
public class LoginController {

    @Resource
    private ConsumerService consumerService;
//    @Resource
//    private AdminRemoteService adminRemoteService;

    /**
     * 支付宝授权接口
     *
     * @param consumerPrivateParameterDto:
     * @return : com.fasterxml.jackson.databind.node.ObjectNode
     * @author : gaozifeng
     * @date : 2019/5/22 17:00
     */
    @GetMapping("/alipay_user")
    public ObjectNode aliCode(ConsumerPrivateParameterDto consumerPrivateParameterDto) {
        return consumerService.alipayUser(consumerPrivateParameterDto);
    }

    /**
     * 微信公众号授权接口
     *
     * @param consumerPrivateParameterDto:
     * @return : com.fasterxml.jackson.databind.node.ObjectNode
     * @author : gaozifeng
     * @date : 2019/5/22 17:00
     */
    @GetMapping("/wechat_user")
    public ObjectNode wechatCode(ConsumerPrivateParameterDto consumerPrivateParameterDto) {
        return consumerService.wecharCode(consumerPrivateParameterDto);
    }
//
//    @GetMapping("/test")
//    public String ok(String id ){
//        String adminName = adminRemoteService.getAdminName(id);
//        System.out.println(JSON.toJSONString(adminName));
//        return "OK";
//    }
}
